<?php

namespace app\api\model;

use app\common\library\Token;
use app\common\model\BaseModel;
use think\facade\Db;

class UserBill extends BaseModel
{
    // 表名
    protected $name = 'user_bill';


    public function addUserBill($data)
    {
        $model = new self();
        $model->user_id = $data['user_id'] ?? '';
        $model->title = $data['title'] ?? '';
        $model->type = $data['type'] ?? 1;
        $model->amount = $data['amount'] ?? 0;
        $model->create_time = time();

        if (!$model->save()) {
            return false;
        }

        return true;
    }
}
